<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>提示弹窗</title>
    <style>
      body {
        text-align: center;
      }
      .popup {
        position: relative;
        display: inline-block;
      }
      .popuptext {
        /* display: none; */
        opacity: 0;
        left: -6px;
        top: -39px;
        color: #ffffff;
        background: #000000bd;
        position: absolute;
        width: 100px;
        height: 30px;
        line-height: 30px;
        border-radius: 8px;
      }
      .popup .popuptext::after {
        content: "";
        position: absolute;
        top: 100%;
        left: 50%;
        margin-left: -5px;
        border-width: 5px;
        border-style: solid;
        border-color: #555 transparent transparent transparent;
      }
      @keyframes zx {
        0% {
          opacity: 0;
        }
        50% {
          opacity: 1;
        }
        100% {
          opacity: 0;
        }
      }
    </style>
  </head>
  <body>
    <h2>弹窗</h2>

    <div class="popup" onclick="myFunction()">
      点我有弹窗!
      <span class="popuptext" id="myPopup">提示信息!</span>
    </div>
    <script>
      function myFunction() {
        document.getElementById("myPopup").style.animation = "zx 3s";
     
        setTimeout(() => {
          document.getElementById("myPopup").style.animation = "";
        }, 3000);
      }
    </script>
  </body>
</html>
